package com.gao.pojo;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Max;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @Projectname springboot-02-config
 * @Filename Person
 * @Author an
 * @Data 2022/8/7 18:05
 * @Description TODO
 */
@Component
@Data
//加载指定的配置文件
@ConfigurationProperties(prefix = "person")
//javaConfig绑定我们自己的配置文件的值，可以采用这种方式
//@PropertySource(value = "classpath:gao.properties")
@Validated //数据校验
public class Person {

    //SPEL表达式取出配置文件的值
//    @Value("${name}")


    private String name;
    @Max(99)
    private Integer age;
    private Boolean happy;
    private Date birth;
    private Map<String,Object> map;
    private List<Object> list;
    private Dog dog;


}
